import java.util.concurrent.*;

class News {
    private long nid;
    private String title;

    public News(long nid, String title) {
        this.nid = nid;
        this.title = title;
    }

    public String toString() {
        return "【新闻数据】新闻编号：" + this.nid + "、新闻标题：" + this.title;
    }
}
class Cache<K, V> {
    private final ConcurrentHashMap<K, V> cacheMap = new ConcurrentHashMap<>();

    public void put(K key, V value) {
        cacheMap.put(key, value);
    }

    public V get(K key) {
        return cacheMap.get(key);
    }

    public void remove(K key) {
        cacheMap.remove(key);
    }
}

public class YootkDemo13 {
    public static void main(String[] args) throws Exception {
        Cache<Long, News> cache = new Cache<Long, News>();
        cache.put(1L, new News(1L, "沐言科技：www.yootk.com"));
        cache.put(2L, new News(2L, "李兴华高薪就业编程训练营：edu.yootk.com"));
        System.out.println(cache.get(2L));
        System.out.println(cache.get(1L));
        TimeUnit.SECONDS.sleep(5);
        System.out.println("--- 5秒之后再次读取数据 ---");
        System.out.println(cache.get(1L));
    }
}